use ../Data/Clean/cleaned_recruiter_data.dta, clear
	* comapring white to white since we could not find enough black candidates. 
	keep if hiringmanageriswhite==1
	gen hm_female=hiringmanagerismale==0
	gen c_female=candidateismale==0
	gen c_black=candidateiswhite==0
	gen c_elite=candidateeliteschool
	gen p_acceptinterview = pacceptinterview
	gen p_passinterview = ppassinterview
	gen p_acceptoffer = pacceptjoboffer
	gen eval_male = screenerismale==1 //evaluator is male
	gen eval_white = screeneriswhite==1 //evaluator is white
	keep screenerid c_female c_black c_elite interview hm_female p_acceptinterview p_passinterview p_acceptoffer eval_male eval_white
	tostring(screenerid), replace
	gen recruiter_response=1


tempfile main
save "`main'"

use "../Data/Clean/clean_accuracy_candidates.dta", clear
	* comparing white to white since we could not find enough black candidates. 
	keep if race_white==1
	drop if missing(p_acceptoffer )
	drop if missing(p_acceptinterview )
	drop if missing(interview)
	rename responseid screenerid
	gen recruiter_response=0
	gen hm_female=gender_female
	gen eval_male = gender_male==1
	gen eval_white = race_white==1


append using "`main'"

foreach var in c_female c_black c_elite p_acceptinterview p_passinterview p_acceptoffer {
	gen rr_`var'=recruiter_response*`var'
}

label var c_female "Female Job Applicant "
label var c_black "Black Job Applicant "
label var c_elite "Elite School Job Applicant "
label var rr_c_female "Recruiter Eval$\times$ Female Applicant "
label var rr_c_black "Recruiter Eval$\times$ Black Applicant "
label var rr_c_elite "Recruiter Eval$\times$ Elite School Applicant "
label var p_passinterview "\Centerstack{P(Passes\! Interview)}"
label var p_acceptinterview "\Centerstack{P(Accepts\! Interview)}"
label var p_acceptoffer "\Centerstack{P(Accepts\! Offer)}"
label var interview "Interview"
label var rr_p_passinterview "Recruiter Eval$\times$  \Centerstack{P(Passes\! Interview)}"
label var rr_p_acceptinterview "Recruiter Eval$\times$  \Centerstack{P(Accepts\! Interview)}"
label var rr_p_acceptoffer "Recruiter Eval$\times$  \Centerstack{P(Accepts\! Offer)}"
label var recruiter_response "Recruiter Eval"

gen p_hire=p_acceptinterview *p_passinterview *p_acceptoffer




************************************************************
****** Table C.2: ACCURACY OF MANAGER EVALUATIONS (NO F.E) *
************************************************************

gen absorb_constant=1
reghdfe p_acceptinterview c_female c_black c_elite recruiter_response rr_c_female rr_c_black rr_c_elite, cluster(screenerid) absorb(absorb_constant) 
	estadd local Controls "Y"
	test rr_c_female=rr_c_black=rr_c_elite ==0
	estadd scalar pvalue=`r(p)'
	eststo one

reghdfe p_passinterview c_female c_black c_elite recruiter_response rr_c_female rr_c_black rr_c_elite, cluster(screenerid) absorb(absorb_constant) 
	estadd local Controls "Y"
	test rr_c_female=rr_c_black=rr_c_elite ==0
	estadd scalar pvalue=`r(p)'
	eststo two

reghdfe p_acceptoffer c_female c_black c_elite recruiter_response rr_c_female rr_c_black rr_c_elite, cluster(screenerid) absorb(absorb_constant) 
	estadd local Controls "Y"
	test rr_c_female=rr_c_black=rr_c_elite ==0
	estadd scalar pvalue=`r(p)'
	eststo three

global myopts "bf(%15.2gc) sfmt(%15.2gc) prehead(\begin{tabular}{l*{14}{c}}) postfoot(\end{tabular}) se label noisily noeqlines varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01) replace"
esttab one two three using ../Output/Tables/Appendix/TableC02.tex, $myopts keep(c_female c_black c_elite recruiter_response rr_*) stat(pvalue N r2, label("P(Recruiter Coeffs All Zero)" "\hline Observations" \(R^{2}\)) fmt(%9.2f 0 %9.2f))


************************************************************
****** Table C.3: ACCURACY OF MANAGER EVALUATIONS (W/ F.E) *
************************************************************


reghdfe p_acceptinterview c_female c_black c_elite rr_c_female rr_c_black rr_c_elite recruiter_response, cluster(screenerid) absorb(screenerid) 
	estadd local Controls "Y"
	test rr_c_female=rr_c_black=rr_c_elite ==0
	estadd scalar pvalue=`r(p)'
	eststo one

reghdfe p_passinterview c_female c_black c_elite rr_c_female rr_c_black rr_c_elite recruiter_response, cluster(screenerid) absorb(screenerid) 
	estadd local Controls "Y"
	test rr_c_female=rr_c_black=rr_c_elite ==0
	estadd scalar pvalue=`r(p)'
	eststo two

reghdfe p_acceptoffer c_female c_black c_elite rr_c_female rr_c_black rr_c_elite recruiter_response, cluster(screenerid) absorb(screenerid) 
	estadd local Controls "Y"
	test rr_c_female=rr_c_black=rr_c_elite ==0
	estadd scalar pvalue=`r(p)'
	eststo three

global myopts "bf(%15.2gc) sfmt(%15.2gc) prehead(\begin{tabular}{l*{14}{c}}) postfoot(\end{tabular}) se label noisily noeqlines varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01) replace"
esttab one two three using ../Output/Tables/Appendix/TableC03.tex, $myopts keep(c_female c_black c_elite rr_*) stat(pvalue Controls N r2, label("P(Recruiter Coeffs All Zero)" "Evaluator FEs" "\hline Observations" \(R^{2}\)) fmt(%9.2f 0 0 %9.2f))



**************************************************************
****** Table C.4: CALLBACK DECISIONS: RECRUITERS VS MANAGERS *
**************************************************************

reghdfe interview c_female c_black c_elite recruiter_response rr_c_female rr_c_black rr_c_elite, cluster(screenerid) absorb(absorb_constant) 
	test rr_c_female=rr_c_black=rr_c_elite ==0
	estadd scalar pvalue=`r(p)'
	eststo one

reghdfe interview c_female c_black c_elite rr_c_female rr_c_black rr_c_elite, cluster(screenerid) absorb(screenerid) 
	estadd local Controls "Y"
	test rr_c_female=rr_c_black=rr_c_elite ==0
	estadd scalar pvalue=`r(p)'
	eststo two

global myopts "bf(%15.2gc) sfmt(%15.2gc) prehead(\begin{tabular}{l*{14}{c}}) postfoot(\end{tabular}) se label noisily noeqlines varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01) replace"
esttab one two using ../Output/Tables/Appendix/TableC04.tex, $myopts keep(c_female c_black c_elite recruiter_response rr_*) stat(pvalue Controls N r2, label("P(Recruiter Coeffs All Zero)" "Evaluator FEs" "\hline Observations" \(R^{2}\)) fmt(%9.2f 0 0 %9.2f))


**************************************************************
****** Table C.5: CALLBACK DECISIONS: RECRUITERS VS MANAGERS *
**************************************************************

reg interview p_acceptinterview p_passinterview p_acceptoffer recruiter_response rr_p_acceptinterview rr_p_passinterview rr_p_acceptoffer , r  cluster(screenerid)
	test rr_p_acceptinterview= rr_p_passinterview =rr_p_acceptoffer=0
	estadd scalar pvalue=`r(p)'
	eststo one
	
reghdfe interview p_acceptinterview p_passinterview p_acceptoffer rr_p_acceptinterview rr_p_passinterview rr_p_acceptoffer , cluster(screenerid) absorb(screenerid)
	estadd local Controls "Y"
	test rr_p_acceptinterview= rr_p_passinterview =rr_p_acceptoffer=0
	estadd scalar pvalue=`r(p)'
	eststo two

reg interview   p_passinterview p_acceptoffer recruiter_response rr_p_passinterview rr_p_acceptoffer ,  r cluster(screenerid)
	test  rr_p_passinterview =rr_p_acceptoffer=0
	estadd scalar pvalue=`r(p)'
	eststo three

reghdfe interview   p_passinterview p_acceptoffer rr_p_passinterview rr_p_acceptoffer , cluster(screenerid) absorb(screenerid)
	estadd local Controls "Y"
	test  rr_p_passinterview =rr_p_acceptoffer=0
	estadd scalar pvalue=`r(p)'
	eststo four
	
	
global myopts "bf(%15.2gc) sfmt(%15.2gc) prehead(\begin{tabular}{l*{14}{c}}) postfoot(\end{tabular}) se label noisily noeqlines varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01) replace"
esttab one two three four using ../Output/Tables/Appendix/TableC05.tex, $myopts keep( p_acceptinterview p_passinterview p_acceptoffer recruiter_response rr_p_acceptinterview rr_p_passinterview rr_p_acceptoffer) stat(pvalue Controls N r2, label("P(Recruiter Coeffs All Zero)" "Evaluator FEs" "\hline Observations" \(R^{2}\)) fmt(%9.2f 0 0 %9.2f))
	